package com.wimcorp.magic.behaviour.attack;

import javax.persistence.Entity;

import com.wimcorp.magic.cards.Creature;
import com.wimcorp.magic.players.Player;

@Entity
public class DeathTouch  extends AttackBehaviour {

	private static DeathTouch instance = new DeathTouch();
	
	public DeathTouch() {}
	
	public DeathTouch(Creature creature,AttackBehaviour attackBehaviour) {
		super(creature,attackBehaviour);
	}

	public static DeathTouch instance() {
		return instance;
	}

	protected void attack(Creature defender) {
		defender.subtractLife(defender.getActualToughness());
		getCreature().setActualPower(getCreature().getActualPower()-1);
		getAttackBehaviour().attack(defender);
		
	}
	
	@Override
	public void counter(Creature attacker) {
		attacker.subtractLife(attacker.getActualToughness());
		getCreature().setActualPower(getCreature().getActualPower()-1);
		getAttackBehaviour().counter(attacker);
	}


	protected void attack(Player defender) {
		getAttackBehaviour().attack(defender);
	}
	
	

	public int priority() {
		return AttackType.DEATHTOUCH.ordinal();
	}

	public boolean equals(Object o) {
		return o instanceof DeathTouch;
	}

	
	

}
